package com.bit.cfdi.web.constants;

import java.util.ArrayList;
import java.util.List;
import java.util.Locale;


public class CFDIConstants {
	
	//Email regex
	public static final String EMAIL_PATTERN = "^[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$";
	//END Email regex
	
	/**EXPRESION REGULAR PARA VALIDAR EL RFC*/
	public final static String RFC_PATTERN = "^(([A-Za-z\u00D1]{4})|([A-Za-z\u00D1\\-&]{1}[A-Za-z\u00D1\\-&]{1}[A-Za-z\u00D1\\-&]{1}))[0-9]{1}[0-9]{1}(0[1-9]|1[012]){1}(0[1-9]|[12][0-9]|3[01]){1}([A-Za-z0-9]{3})$";
	/**EXPRESION REGULAR PARA VALIDAR EL RFC*/
	public static final String RAZON_REGEX = 
			"[A-Za-z0-9\u00E1\u00E9\u00ED\u00F3\u00FA\u00FC\u00C1\u00C9\u00CD\u00D3\u00DA\u00DC\u00F1\u00D1\u00BF\u003F \\-&.,+%\"\'()\\/\u0040]+";
	
	//Password strength check regex
	//Minimum 6 characters maximum 12, non empty spaces
	public static final String NUMBER_OF_CHARS = "^[\\S]{6,12}$";
	public static final String PASSWORD_EXPRESSION = "((?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%]).{6,20})";
	public static final String PASSWORD_REQUIREMENTS = "El password es inseguro, mínimo debe tener:\n" +
														"1) de 6 a 20 dígitos\n" +
														"2) Altas y bajas\n" +
														"3) Números\n" +
														"4) Aguno de estos caracteres especiales @ # $ % ";
	//END Password strength check regex
	
	//Date Format
	public static final String CFDI_DATE_FORMAT = "EEEEEEE d 'de' MMMMMMMMMM 'de' yyyy HH:mm:ss";
	
	//Mexico Locale
	public static final Locale MEXICO_LOCALE = new Locale("es","MX");
	
	//Image utils constants
	public static final String JPEG_FORMAT = "jpeg";
	public static final String GIF_FORMAT = "gif";
	public static final String PNG_FORMAT = "png";
	
	public static final List<String> SUPPORTED_IMAGES = new ArrayList<String>();
	
	static {
		SUPPORTED_IMAGES.add(JPEG_FORMAT);
		SUPPORTED_IMAGES.add(GIF_FORMAT);
		SUPPORTED_IMAGES.add(PNG_FORMAT);
	}
	
	//Type of files
	//.cer file
	public static final String CERT_FILE = "application/x-x509-ca-cert";
	//.key file
	public static final String KEY_FILE = "application/octet-stream";
	
	public static class CFDIPages {
		public static final String HOME_URL = "/home.zul";
		public static final String LOGIN_URL = "/login.zul";
		public static final String WIZARD_URL = "/wizard.zul";
	}
	
	public static class ServicesKeys {
		public static final String SESSION_UTILS_KEY = "SessionUtils";
		public static final String USUARIO_NEGOCIO_SERVICE = "UsuarioNegocioService";
	}
	
	public static void main(String args[]) {
		String hola = "";
		if(!hola.matches(PASSWORD_EXPRESSION)) {
			System.out.println("Error");
		}
		else {
			System.out.println("Pass");
		}
	}
}
